package com.cjm.algorithm.dp;

public class Ti509 {
    public static void main(String[] args) {
        Ti509 ti509 = new Ti509();
        int fib = ti509.fib(20);
        int fib1 = ti509.extracted(20);
        System.err.println("ob");
    }
    public int fib(int n) {
        int[] dp = new int[n+1];
        dp[0] = 0;
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            dp[i] = dp[i-1] + dp[i-2];
        }
        return dp[n];
    }

    private int extracted(int n) {
        if (n -1==0) {
            return 1;
        }
        if (n == 0) {
            return 0;
        }
        return fib(n - 1) + fib(n - 2);
    }
}
